package com.springboot.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

@Data
public class Register {

    @NotEmpty(message = "用户名不能为空！")
    @NotNull(message = "用户名不能为空！")
    @Size(min = 4, max = 20, message = "用户名长度必须在4到20之间！")
    private String name;

    @NotEmpty(message = "密码不能为空！")
    @NotNull(message = "密码不能为空！")
    @Size(min = 6, max = 16, message = "密码长度必须在6到16之间！")
    private String password;

    @NotEmpty(message = "邮箱地址不能为空！")
    @NotNull(message = "邮箱地址不能为空！")
    @Email(message = "邮箱地址不符合规范！")
    private String email;

    @Pattern(regexp = "^1[34578]\\d{9}$", message = "手机号码格式不正确！")
    @NotEmpty(message = "手机号码不能为空！")
    @NotNull(message = "手机号码不能为空！")
    private String tel;

    //类别
    @NotEmpty(message = "请选择注册类型！")
    @NotNull(message = "请选择注册类型！")
    private String category;

    //图片验证码
    @NotEmpty(message = "验证码不能为空！")
    @NotNull(message = "验证码不能为空！")
    private String clientCode;
}
